package leetcode;

import org.junit.Test;

/**
 * @author Mr.LL
 * @version 1.0
 */
public class leetcode26 {

    @Test
    public void test(){
        int[] nums = {0,0,1,1,1,2,2,3,3,4};//0,1,2,3,4
        System.out.println(removeDuplicates(nums));
    }

    public int removeDuplicates(int[] nums){
        // 索引值
        int index = 0;
        for(int i = 0;i < nums.length; i++){
            if (nums[index] != nums[i]){
                nums[++index]=nums[i];
            }
        }
        return ++index;
    }
}
